package com.trkj.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.trkj.dao.OrderWorkDao;
import com.trkj.entity.OrderWorkEntity;
import com.trkj.entity.UserEntity;
import com.trkj.entity.ZongEntity;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Slf4j
public class OrderWorkServiceImpl implements OrderWorkService{
    @Autowired
    private OrderWorkDao orderWorkDao;
    @Override
    @Cacheable(cacheNames = "allOrderWork",key = "#currentPage+','+#pageSize")
    public PageInfo<OrderWorkEntity> OrderWorkList(OrderWorkEntity orderWorkEntity , int currentPage, int pageSize){
        PageHelper.startPage(currentPage,pageSize);
        List<OrderWorkEntity> List= this.orderWorkDao.OrderWorkList(orderWorkEntity);
        PageInfo<OrderWorkEntity> pageDto=new PageInfo<>(List);
        log.debug("123:{}",pageDto);
        return pageDto;
    }
    @Override
    public List<OrderWorkEntity> GongDanDetail(String bianhao){
        return orderWorkDao.GongDanDetail(bianhao);
    }
    @Override
    @Transactional
    public boolean CaoZuoGongDanDetail(OrderWorkEntity orderWorkEntity){
        return orderWorkDao.CaoZuoGongDanDetail(orderWorkEntity);
    }
    @Override
    public List<OrderWorkEntity> OrderLX(){
        return orderWorkDao.OrderLX();
    }
    @Override
    public  List<OrderWorkEntity> Orderwork(OrderWorkEntity orderWorkEntity){
        return orderWorkDao.Orderwork(orderWorkEntity);
    }
    @Override
    @Transactional
    public boolean addOrderWork(OrderWorkEntity orderWorkEntity){
        return orderWorkDao.addOrderWork(orderWorkEntity);
    }
    @Override
    public List<ZongEntity> orderfindAll() {
        return orderWorkDao.orderfindAll();
    }
    @Override
    public List<ZongEntity> findAll1(ZongEntity zongEntity){
        return orderWorkDao.findAll1(zongEntity);
    }

    @Override
    public List<OrderWorkEntity> findOrderNum() {
        return orderWorkDao.findOrderNum();
    }

    @Override
    public List<OrderWorkEntity> countOrder() {
        return orderWorkDao.countOrder();
    }

    @Override
    public List<OrderWorkEntity> findOrderNum1() {
        return orderWorkDao.findOrderNum1();
    }

    @Override
    public List<OrderWorkEntity> findOrderZB(){
        return orderWorkDao.findOrderZB();
    }
    @Override
    public List<OrderWorkEntity> ChaAdressFenBu(){
        return orderWorkDao.ChaAdressFenBu();
    }
}
